#ifndef GAMEAUDIO_H
#define GAMEAUDIO_H

#include "BaseAudio.h"
#include "VisibleObject.h"
#include <OGRE\OgreCamera.h>

// Information about the source in OpenAL
struct SourceData
{
	ALuint buffer;
	VisibleObjectPtr obj;
};

typedef std::map<ALuint, SourceData> AdvancedSourceMap;

class GameAudio :
	public BaseAudio
{
public:
	GameAudio(void);
	virtual ~GameAudio(void);
	const bool init(void);
	const bool init(Ogre::Camera *cam);
	void setListener(Ogre::Camera *cam);
	void setListenerPosition(const ALfloat x, const ALfloat y, const ALfloat z);
	void setPosition(const ALuint source, const ALfloat x, const ALfloat y, const ALfloat z);
	void setGlobalVolume(const ALfloat volume);
	const ALfloat getGlobalVolume(void) const;
	const ALuint playSound(const SoundType type, const bool loop, const VisibleObjectPtr obj);
	const ALuint playSound(const SoundType type, const bool loop);
	void playSound(const ALuint source);
	void stopSound(const ALuint source) const;
	void pauseSound(const ALuint source) const;
	void pauseAllSounds(void);
	void resumeAllSounds(void);
	void releaseSound(const ALuint source);
	const bool isPlaying(const ALuint source);
	void setBGMusic(const SoundType type);
	void stopBGMusic(void);
	void update(void);
private:
	Ogre::Camera *mpListener;
	// Map with sounds in OpenAL
	AdvancedSourceMap mAdvancedSourceMap;
	// List with all sound that were paused
	std::list<ALuint> mPausedList;
};

#endif